package YOOTK;
import java.net.*;
import java.util.Scanner;
public class HelloClient {
    public static void main(String[] args) throws Exception {
        // 设置服务器的连接地址（localhost表示本机）以及端口号
        Socket client = new Socket("localhost", 9999);
        System.out.println("[HelloClient] 客户端连接服务端成功...");

        // 接收服务端输出
        Scanner scanner = new Scanner(client.getInputStream());
        if (scanner.hasNext()) { // 接收数据
            System.out.println("[HelloClient] " + scanner.next());
        }

        // 关闭资源
        client.shutdownInput();
        client.close();
    }
}
